package com.heima.homeservicemanagementsystem.utils;

/**
 * @Description
 * @Author jcf
 * @Date 2025/3/25
 */
public class DelUtils {
    /**
     * 文件删除的方法
     *
     * @param filePathAndName
     * @return void
     * @author jinchengfei
     * @create 2025/3/25
     **/

    public static boolean delFile(String filePathAndName) {
        try {
            String filePath = "G:\\biyesheji\\project\\homeServiceManagementSystem\\target\\classes\\static\\upload\\" + filePathAndName;
            filePath = filePath.toString();
            java.io.File myDelFile = new java.io.File(filePath);
            return myDelFile.delete();
        } catch (Exception e) {
            System.out.println("删除文件操作出错");
            e.printStackTrace();
            return false;
        }
    }
    /**
     * 删除static的本地图片
     *
 * @param filePathAndName
     * @return boolean
     * @author jinchengfei
     * @create 2025/4/5
     **/

    public static boolean delFilesStatic(String filePathAndName) {
        try {
            String filePath = "G:\\biyesheji\\project\\homeServiceManagementSystem\\src\\main\\resources\\static\\upload" + filePathAndName;
            filePath = filePath.toString();
            java.io.File myDelFile = new java.io.File(filePath);
            return myDelFile.delete();
        } catch (Exception e) {
            System.out.println("删除文件操作出错");
            e.printStackTrace();
            return false;
        }
    }

}
